#include <baker/Pair.h>
#include <unittest++/UnitTest++.h>

using namespace baker;

SUITE( TestPair )
{
    TEST( sizeof )
    {
        CHECK_EQUAL( sizeof( pair( int(10), int(20) ) ), sizeof(int) * 2 );
    }

    TEST( op_equal )
    {
        const Pair<int, int> a( 10, 20 );
        const Pair<int, int> b( 10, 20 );

        CHECK_EQUAL( a, b );
    }

    TEST( op_less )
    {
        const Pair<int, int> a( 10, 20 );
        const Pair<int, int> b( 5, 10 );

        CHECK( b < a );
        CHECK( !( a < b ) );
    }

    TEST( op_assign )
    {
        const Pair<int, int> a( 10, 20 );
        Pair<int, int> b = a;

        CHECK_EQUAL( a, b );
        CHECK_EQUAL( b, a );

        CHECK_EQUAL( b._1, 10 );
        CHECK_EQUAL( b._2, 20 );
    }
}
